<template>
    <a-modal
            title="查看"
            :visible="visible"
            width="1200px"
            @ok="handleOk"
            :confirmLoading="confirmLoading"
            @cancel="handleCancel"
    >
        <!-- <table>
            <tr>
                <td>载体名称</td>
                <td>企业名称</td>
                <td>联系人信息</td>
                <td>联系人电话</td>
                <td>入驻时间</td>
            </tr>
            <tr v-for="(item,index) in form" :key="index">
                <td>{{item.carrierName}}</td>
                <td>{{item.comName}}</td>
                <td>{{item.contactName}}</td>
                <td>{{item.contactPhone}}</td>
                <td>{{item.joinDateDesc | date}}</td>
            </tr>
        </table> -->
        <div class="xl-table">
            <div class="xl-table-content">
                    <xlTable
                            :columns="columns"
                            :dataSource="data"
                            rowKey="id"
                            :pagination="pagination"
                            :loading="loading"
                            @change="handleTableChange"
                            bordered>
                        >
                        <template v-slot:action="scope">  
                            <a @click="seeForm(scope.record)">查看</a>
                        </template>
                    </xlTable>
                </div>
                <xlForm ref="xlForm" @handleOk="handleOk"></xlForm>
                <seeForm ref="seeForm"></seeForm>
            </div>
    </a-modal>
</template>

<script>
    import xlMixin from '@/components/mixin/index'

    export default {
        name: "xlForm",
        mixins:[xlMixin],
        data() {
            return {
                tableTitle: '编辑',
                visible: false,
                confirmLoading: false,
                form: {},
                rules:{},
                columns:[
                    {
                        title: '序号',
                        key: 'rowIndex',
                        align: "center",
                        fixed: 'left',
                        width:'100px',
                        sorter: (a) => a.id,//排序
                        customRender: function (t, r, index) {
                            return parseInt(index) + 1;
                        }
                    },
                    {
                        title: '载体名称',
                        dataIndex: 'carrierName',
                        type:'input'
                    },
                    {
                        title: '企业名称',
                        dataIndex: 'comName',
                        type:'input'
                    },
                    {
                        title: '联系人信息',
                        dataIndex: 'contactName',
                        type:'input'
                    },
                    {
                        title: '联系人电话',
                        dataIndex: 'contactPhone',
                        type:'input'
                    },
                    {
                        title: '入驻时间',
                        dataIndex: 'joinDateDesc',
                        type:'date'
                    },
                ],
                // 请求参数
                paramMore:{
                    
                },
                url: {
                    list: "/carrier/api/carrierComInfo/getListByCarrierId",
                    add: '/ndo/api/ndo/hatch/company/introduction/save',
                    edit: '/ndo/api/ndo/hatch/company/introduction/save',
                    delete: "/ndo/api/ndo/hatch/company/remove",
                    deleteBatch: "/ndo/api/ndo/hatch/company/move/out",
                    exportXlsUrl: "ndo/api/new/dev/org/export/introduction/company",
                    importExcelUrl: "ndo/api/ndo/hatch/company/importExcel",
                    importExcelDemoUrl:'/ndo/api/ndo/hatch/company/importTemplate'
                }
            }
        },
        components:{
            
        },
        created(){
            this.formatMerge()
        },
        methods: {
            handleOk() {
                this.visible = false
            },
            handleCancel() {
                this.visible = false
            },
            formatForm(form,number) {
                delete form.createDateTime
                delete form.modifyDateTime
                delete form.modifyBy
                delete form.createBy
                console.log(number,121212121212)
                //整理字段数据 ／ 赋值 清空等   1-高企 2-民营 3-软件 4-科小
                
                if(number == 1){
                    this.paramMore.carrierId = form.id
                    this.paramMore.comFlag = 1
                    this.paramMore.carrierType = form.carrierType
                }
                if(number == 2){
                    this.paramMore.carrierId = form.id
                    this.paramMore.comFlag = 2
                    this.paramMore.carrierType = form.carrierType
                }
                if(number == 3){
                    this.paramMore.carrierId = form.id
                    this.paramMore.comFlag = 4
                    this.paramMore.carrierType = form.carrierType

                    
                }
                if(number == 4){
                    this.paramMore.carrierId = form.id
                    this.paramMore.comFlag = 3
                    this.paramMore.carrierType = form.carrierType

                   
                }
                
            }
        }
    }
</script>

<style scoped lang="less">
table {
    width: 100%;
    border-collapse: collapse;/*表格样式。如果可能，边框会合并为一个单一的边框。会忽略 border-spacing 和 empty-cells 属性*/
        
}
.right{
    text-align: right;
    padding-right: 25px;
}
td,th{
    border: 1px solid ;
    border-color: #ccc;
    font-size: 14px;
    text-align: center;
    height: 40px;
}
    /deep/ .ant-form-item {
        margin: 0;
    }

    /deep/.ant-input-number{
        width: 100%;
    }
    .xl-dateRange{
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    .ant-checkbox-group{
        display: flex;
        flex-wrap: wrap;
        .xl-checkbox{
            display: flex;
            align-items: center;
            /deep/ span:nth-child(2):not(.ant-checkbox-inner){
                display: flex;
                justify-content: space-between;
                white-space: pre;
            }
        }
    }
    .xl-table{
        .xl-table-content{
            padding: 16px;
        }
    }
</style>
